<template>
  <div class="container">
    <div class="head">
      <div class="left">
        <div class="title">单曲推荐</div>
        <div class="button">
          <uni-icons type="sound" size="18" />
          <div>播放</div>
        </div>
      </div>
      <div class="right">
        <uni-icons type="reload" size="18" />
        <div>换一批</div>
      </div>
    </div>
    <div class="kindList">
      <div
        class="kind"
        v-for="item in kindList"
        :key="item.id"
        @click="changeKind(item)"
        :class="{ kind_active: currentKindIndex === item.id }"
      >
        {{ item.name }}
      </div>
    </div>

    <div class="musicLise"></div>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
interface KindItem {
  id: number;
  name: string;
}
const kindList = ref([
  { id: 1, name: "全部" },
  { id: 2, name: "流行" },
  { id: 3, name: "DJ" },
  { id: 4, name: "情歌" },
  { id: 5, name: "伤感" },
  { id: 6, name: "轻松" },
  { id: 7, name: "安静" },
  { id: 8, name: "快乐" },
  { id: 9, name: "思念" },
  { id: 10, name: "兴奋" },
  { id: 11, name: "兴奋" },
]);
const currentKindIndex = ref(kindList.value[0].id);
const changeKind = (item: KindItem) => {
  currentKindIndex.value = item.id;
};
</script>

<style scoped lang="scss">
.container {
  height: 100%;
  padding: 0 0.5rem;
  .head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;

    .left {
      display: flex;
      gap: 0.7rem;
      align-items: center;
      .title {
        font-weight: 700;
      }
      .button {
        padding: 0.2rem 0.5rem;
        display: flex;
        background-color: RGB(255, 255, 255);
        border-radius: 0.6rem;
        font-size: small;
        border: 0.5px solid var(--border-color, rgba(246, 243, 243, 0.543));
        box-shadow: 1px 2px 2px 0.5px rgba(5, 5, 5, 0.1);
        font-weight: 700;
      }
    }
    .right {
      display: flex;
      gap: 2px;
      font-size: 0.8rem;
      align-items: center;
    }
  }
  .kindList {
    overflow-y: hidden;
    overflow-x: auto;
    display: flex;
    gap: 0.8rem; /* 设置子元素之间的间距 */
    width: 100%;
    -ms-overflow-style: none; /* IE 10+ 隐藏滚动条 */
    scrollbar-width: none; /* Firefox 隐藏滚动条 */
    white-space: nowrap;
    .kind {
      padding: 0.2rem 0.5rem;
      transition: ease 0.1s;
    }
    .kind_active {
      border-radius: 0.6rem;
      background-color: rgb(90 154 248);
      color: white;
      transition: ease 0.1s;
    }
  }
  .kindList::-webkit-scrollbar {
    display: none; /* WebKit 浏览器隐藏滚动条 */
  }
}
</style>
